<?php defined('SYSPATH') or die('No direct script access.');

class Controller_GradeHorariaFrontEnd extends Controller_Base_FrontEnd {
//        protected $consumer;
//
	public $view;
	public function before(){
            parent::before(); //<=NOTHING BY DEFAULT
	}
	public function  __construct(Request $request, Response $response) {
		parent::__construct($request, $response);
//		$this->view = Smarty_View::factory('gm_base/html.tpl');
        
                $this->view->js["grademagica_ui"] = array(
                            "type"=>"text/javascript",
                            "src"=>DOC_ROOT."modules/grademagica/static/jscript/grademagica_ui.js",
                            );
                $this->view->css["grademagica"] = array(
                        "rel"=>"stylesheet",
                        "href"=>DOC_ROOT."modules/grademagica/static/css/grademagica.css",
                        "type"=>"text/css",
                        "media"=>"screen",
                        "charset"=>"utf-8",
                    );
                $this->view->css["blue"] = array(
                        "rel"=>"stylesheet",
                        "href"=>DOC_ROOT."modules/grademagica/static/css/blue.css",
                        "type"=>"text/css",
                        "media"=>"screen",
                        "charset"=>"utf-8",
                    );
        
		$this->view->body = Smarty_View::factory('gm_base/body_frontend.tpl');

		$this->view->body->top = Smarty_View::factory('gm_base/top.tpl');
		$this->view->body->menu = Smarty_View::factory('gm_base/menu.tpl');
                $this->view->body->menu->selected = $this->request->uri();
		$this->view->body->content = "";
		$this->view->body->sidebar = "";
		$this->view->body->footer = Smarty_View::factory("gm_base/footer.tpl");
	}
        
        public function logged_in_area(){
            if(!Model_User::logged_in(Kohana::$config->load("grademagica")->webuser_role_name)) {
                $redirect = '';
//                die($this->request->uri());
//                die('!'.$this->request->uri().'!');
                if($this->request->uri()!='/' && $this->request->uri()!='cadastro'){
                    $redirect = '?redirect='.$this->request->uri();
                }
//                $this->request->redirect();
                $this->request->redirect($this->language."cadastro".$redirect);
            }
        }
	
} // End Frontend